/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const { mergeConfig } = require("metro-config");
const BaseConfig = require('./metro.config')
const env = process.env;
const platform = env.platform || 'ios';
const dependencies = require(`./dependencies-${platform}.json`);

const cwd = __dirname + '/'
const config = {
  serializer: {
    createModuleIdFactory: () => {
      return (p1) => {
        const p = p1.replace(cwd, '')
        const index = dependencies.indexOf(p)
        return index;
      };
    },
    processModuleFilter: (m) => {
      const p = m.path.replace(cwd, '');
      return dependencies.includes(p);
    },
  },
};

module.exports = mergeConfig(BaseConfig, config)